Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Traefik Dashboard #797

Merged
merged 59 commits into from
Sep 13, 2021
Merged

Add Traefik Dashboard #797

merged 59 commits into from
Sep 13, 2021

Conversation

Adam-D-Lewis
Copy link
Member

@Adam-D-Lewis Adam-D-Lewis commented Aug 31, 2021

  • Configures Traefik to produce data for Prometheus to Scrape
  • Configures Prometheus to scrape data from Traefik
  • Adds a grafana dashboard displaying relevant traefik data

Comment on lines 13 to 26
# This job will scrape from any service with the label app.kubernetes.io/component=traefik-internal-service
# and the annotation app.kubernetes.io/scrape=true
- job_name: 'traefik'

kubernetes_sd_configs:
- role: service

relabel_configs:
- source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_component]
action: keep
regex: traefik-internal-service
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
action: keep
regex: true
Copy link
Member Author

@Adam-D-Lewis Adam-D-Lewis Aug 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As set up now, this will scrape only k8s services with both labels app.kubernetes.io/component: traefik-internal-service and prometheus.io/scrape: true (see relabel configs).

It is possible to instead scrape all services with the label prometheus.io/scrape: true, but they'll all be included under the same prometheus job. I'm not sure if that's the "right way" to do things in Prometheus given their definition of job which I've pasted below (from here):

In Prometheus terms, an endpoint you can scrape is called an instance, usually corresponding to a single process. A collection of instances with the same purpose, a process replicated for scalability or reliability for example, is called a job.

Copy link
Member Author

@Adam-D-Lewis Adam-D-Lewis Aug 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@costrouc, your thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As set up now, this will scrape only k8s services with both labels app.kubernetes.io/component: traefik-internal-service and prometheus.io/scrape: true (see relabel configs).

I'm not a fan of this since for each new service we'll have to add a new job for scraping.

It is possible to instead scrape all services with the label prometheus.io/scrape: true, but they'll all be included under the same prometheus job.

This is exactly what I'd like to have. I'd like to not have to require development to qhub to require additional modifications to the monitoring configuration.

@Adam-D-Lewis
Copy link
Member Author

Adam-D-Lewis commented Aug 31, 2021

I also had to edit the traefik dashboard a bit since our traefik container (not pod) is called qhub instead of traefik. Additionally, some of the prometheus metrics queried did not include the namespace label, and the dashboard assumed they did. I think this PR is good to go.

@Adam-D-Lewis Adam-D-Lewis changed the title Prometheus grafana [WIP] Add Traefik Dashboard Aug 31, 2021
@costrouc
Copy link
Member

costrouc commented Sep 1, 2021

Asside from requiring two labels this PR looks good to me. I'd like to have anything with prometheus.io/scrape: true be scraped.

@tylerpotts
Copy link
Contributor

Combined the 4 return code graphs into one

image

@Adam-D-Lewis
Copy link
Member Author

Adam-D-Lewis commented Sep 7, 2021

I'm testing out adding a sleep function before cypress runs, but the tests are still flaky (passed once, failed once) when sleeping 60 seconds before cypress runs. This did not end up working, but Dan fixed the underlying issue separately by increasing the size of our DO instance for the test.

@Adam-D-Lewis Adam-D-Lewis merged commit 8d1ae18 into main Sep 13, 2021
@Adam-D-Lewis Adam-D-Lewis deleted the prometheus_grafana branch January 26, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add premade dashboard to monitor Traefik [enhancement]
5 participants